package cn.echoparrot.domain.entity;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.springframework.data.neo4j.core.schema.GeneratedValue;
import org.springframework.data.neo4j.core.schema.Id;
import org.springframework.data.neo4j.core.schema.Node;
import org.springframework.data.neo4j.core.schema.Relationship;

import java.time.LocalDateTime;
import java.util.List;

@Node("File")
@Accessors(fluent = true, chain = true)
@Data
@ToString
@EqualsAndHashCode
public class DataFile {
    @Id
    @GeneratedValue
    private Long id;
    private final String name;

    @Relationship(type = "CONTAINS",direction = Relationship.Direction.OUTGOING)
    private List<Segment> segments;
    private LocalDateTime createdAt;

    @Relationship(type = "HAS_FILE",direction = Relationship.Direction.INCOMING)
    private Dataset dataset;

    public DataFile(String name) {
        this.name = name;
    }
    public DataFile(String name, Dataset dataset, List<Segment> segments) {
        this.name = name;
        this.dataset = dataset;
        this.segments = segments;
    }

}